{{extend './common/layout.html'}}

{{block 'link'}}
<link rel="stylesheet" href="/home/css/article.css">
{{/block}}

{{block 'main'}}

{{include './common/header.html'}}

<!-- 文章框架开始 -->
<div class="article">
	<div class="w1100">
		<div class="container">
			<div class="article-header">
				<h3 class="article-title">{{article.title}}</h3>
				<div class="article-info">
					<span class="author">{{article.author.username}}</span>
					<span>{{dateFormat(article.publishDate,"yyyy-mm-dd")}}</span>
				</div>
			</div>
			<div class="article-content">
				{{@article.content}}
			</div>
			<div class="article-comment">
				{{if userInfo}}
				<h4>评论</h4>
				<form class="comment-form" action="/home/comment" method="POST">
					<textarea class="comment" name="content"></textarea>
					<!-- uid 评论的用户id -->
					<input type="hidden" name="uid" value="{{@userInfo._id}}">
					<!-- aid 评论文章的id  -->
					<input type="hidden" name="aid" value="{{@article._id}}">
					<div class="items">
						<input type="submit" value="提交">
					</div>
				</form>
				{{else}}
				<div>
					<h2>先进行登录,再对文章进行评论</h2>
				</div>
				{{/if}}


				<div class="comment-list">
					<div class="mb10">
						<div class="article-info">
							<span class="author">{{article.author.userInfo}}</span>
							<span class="author">访问量:{{article.count}}</span>
						</div>
						<div class="comment-content">
							{{each comment}}
							<div class="article-info">
								<span class="author">{{dateFormat($value.uid.username)}}</span>
								<span class="author">{{dateFormat($value.time,'yyyy-mm-dd-hh:mm:ss')}}</span>
							</div>
							<div class="comment-content">
								{{$value.content}}
							</div>
							{{/each}}

						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- 文章框架结束 -->
{{/block}}